package com.justnow.offer;

import java.util.HashMap;
import java.util.Scanner;

/**
 * @author justnow
 * Created on 2020-09-12
 * Description
 */
public class Wangyi02 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String s = scanner.nextLine();
        int length = s.length();
        char[] allChar = {'a', 'b', 'c', 'x', 'y', 'z'};
        HashMap<Integer, Integer> map = new HashMap<>();
        map.put(0, -1);
        int max = Integer.MIN_VALUE;
        int currentState = 0;
        for (int i = 0; i < length; i++) {
            for (int j = 0; j < allChar.length; j++) {
                if (s.charAt(i) == allChar[j]) {
                    currentState ^= 1 << j;
                }
            }
            map.putIfAbsent(currentState, i);
            max = Math.max(max, i - map.get(currentState));
        }
        System.out.println(max);
    }
}
